package com.frxuexi.lib_base.utils

import androidx.lifecycle.MutableLiveData
import java.util.concurrent.ConcurrentHashMap

object LiveDataBus {
    val map=ConcurrentHashMap<String,SingleLiveEvent<*>>()

    fun <T> with(key:String,type:Class<T>):SingleLiveEvent<T>{
        if(!map.contains(key)){
            map[key]= SingleLiveEvent<T>()
        }
        return map[key] as SingleLiveEvent<T>
    }
}